import request from '@/utils/request'

// 查询产品功能列表
export function listFunc(query) {
  return request({
    url: '/biz/product/func/list',
    method: 'get',
    params: query
  })
}

export function listFuncByDeviceCode(deviceCode) {
  return request({
    url: '/biz/product/func/listByDeviceCode',
    method: 'get',
    params: {
      deviceCode: deviceCode
    }
  })
}

// 查询产品功能详细
export function getFunc(id) {
  return request({
    url: '/biz/product/func/' + id,
    method: 'get'
  })
}

// 新增产品功能
export function addFunc(data) {
  return request({
    url: '/biz/product/func',
    method: 'post',
    data: data
  })
}

// 修改产品功能
export function updateFunc(data) {
  return request({
    url: '/biz/product/func',
    method: 'put',
    data: data
  })
}

// 删除产品功能
export function delFunc(id) {
  return request({
    url: '/biz/product/func/' + id,
    method: 'delete'
  })
}

// 导出产品功能
export function exportFunc(query) {
  return request({
    url: '/biz/product/func/export',
    method: 'get',
    params: query
  })
}

// 添加预定义功能
export function addStdFuncs(data) {
  return request({
    url: '/biz/product/func/addStdFuncs',
    method: 'post',
    data: data
  })
}

// 根据产品id查询产品功能列表
export function getProductFuncList(productId,deviceId) {
  return request({
    url: '/biz/product/func/getProductFuncList/'+productId+'/'+deviceId,
    method: 'get'
  })
}
